import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import HomeView from "../views/HomeView.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/home/index",
  },
  {
    path: "/home",
    component: HomeView,
    children: [
      {
        path: "index",
        component: () => import("../views/index/Index.vue"),
        meta: {
          keepAlive: true, // 自定义的meta属性，用于表示该路由要保活
        },
      },
      {
        path: "video",
        component: () => import("../views/video/Video.vue"),
      },
      {
        path: "me",
        component: () => import("../views/me/Me.vue"),
      },
      {
        path: "show",
        component: () => import("../views/show/Show.vue"),
      },
    ],
  },

  {
    path: "/about",
    name: "about",
    component: () => import("../views/AboutView.vue"),
  },
  {
    path: "/detail/:id",
    name: "detail",
    component: () => import("../views/index/MovieDetail.vue"),
  },
  {
    path: "/cinema-selection/:id",
    name: "cinema-selection",
    component: () => import("../views/index/CinemaSelection.vue"),
  },
  {
    path: "/plan-selection/",
    name: "plan-selection",
    component: () => import("../views/index/PlanSelection.vue"),
  },
  {
    path: "/seat-selection/",
    name: "seat-selection",
    component: () => import("../views/index/SeatSelection.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
